<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="../zuoye/jquery.js"></script>
    <script src="http://libs.baidu.com/jquery/1.10.2/jquery.min.js"></script>
    <link rel="stylesheet" href="../jianli.css">
    <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
</head>
<body>
    <input class="span12" id="dd" type="text"  value="" style="font-size: 18px;margin-top: 4%;">
    <button class="btn"  onclick="fun()" style="background-color: transparent !important;margin-top: -0.5%;border: 1px solid #626262;">Start</button>
    <button class="btn"  onclick="window.hidden()" style="background-color: transparent !important;margin-top: -0.5%;border: 1px solid #626262;">hehe</button>
    <div style="width: 23.3%;height: 100px;border:1px solid #6adcdc;text-align: center;">
        <p id="pp" class="pp"></p>
    </div>
</body>
<script>
            function hidden(){
                document.getElementById("dd").value="";
                document.getElementById("pp").innerHTML ="";
            }
            function fun() {
                var string = document.getElementById("dd").value;//原始数据
                var array = string.split(" "); //转化为数组
                $(".pp").empty();
                var l=array.length;
                for(i=0;i<l;i++){
                    var n=Math.floor(Math.random() * (array.length));
                    $(".pp").append(array[n]+",");//随机选取
                    array.splice(n,1)
                }
            }
</script>
</html>